<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    const arr = [1, 2, 3, 4, 5, 2, 3, 4, 5]
    let count = 0

    for (let i = 0; i < arr.length; i++) {
        for (let k = i + 1; k < arr.length; k++) {
            if (arr [i] === arr[k]) {
                arr.splice(k, 1)
            }
            count++
        }
    }



    console.log(arr, count);
</script>
</body>
</html>
